package com.hhh.demo;

/**
 * 测试不适用临时变量，使用异或的方法交换两个对象的值
 */
public class Demo2 {

    public static void demo(int x,int y){
        x = x^y;
        System.out.println(x);
        y ^= x;
        System.out.println(y);
        x ^= y;
        System.out.println("x = "+x+" , y = "+y);
    }

    public static void main(String[] args) {
        demo(12,88);
    }
}
